package com.cqut.entity;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

/**
 * 员工实体
 * 
 * @author YuanXiang
 * 
 */
@Entity
public class Employee {
	@Id
	@GeneratedValue
	private long id;// 员工ID
	@Column(length=100,nullable=false)
	private String address;// 地址
	@Column(length=50,nullable=false)
	private String email;// 邮件
	@Column(length=50)
	private String interest;// 兴趣爱好
	@Column(length=100,nullable=false)
	private String introduction;// 自我介绍
	private boolean ispublic;// 信息是否公开
	@Column(length=20,nullable=false,unique=true)
	private String name;// 姓名
	@Column(length=20)
	private int number;// 编号
	@Column(length=20,nullable=false)
	private String password;// 密码
	@Column(length=10,nullable=false)
	private String position;// 职位
	@Column(length=15,nullable=false)
	private long qq;// qq
	@Column(length = 1)
	private int sex;// 性别
	@Column(length = 20,nullable=false)
	private long tel;// 电话
	@ManyToOne(fetch=FetchType.LAZY)
	private Partment partmentID;
	private ArrayList<Classification> classifications;//所属名片夹分类
	
	@ManyToMany(fetch = FetchType.LAZY)
	@JoinColumn(name="rightEmployee")
	private Set<Employee> rightEmployee;//你授权给其它的

	@OneToMany(mappedBy="id",fetch=FetchType.LAZY,targetEntity=Classification.class)
	@JoinColumn(name="classifications")
	public ArrayList<Classification> getClassifications() {
		return classifications;
	}

	public void setClassifications(ArrayList<Classification> classifications) {
		this.classifications = classifications;
	}

	public String getAddress() {
		return address;
	}

	public String getEmail() {
		return email;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getInterest() {
		return interest;
	}

	public String getIntroduction() {
		return introduction;
	}

	public String getName() {
		return name;
	}

	public int getNumber() {
		return number;
	}
	public String getPassword() {
		return password;
	}

	public String getPosition() {
		return position;
	}

	public long getQq() {
		return qq;
	}

	public int getSex() {
		return sex;
	}

	public long getTel() {
		return tel;
	}

	public boolean isIspublic() {
		return ispublic;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public void setInterest(String interest) {
		this.interest = interest;
	}

	public void setIntroduction(String introduction) {
		this.introduction = introduction;
	}

	public void setIspublic(boolean ispublic) {
		this.ispublic = ispublic;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setNumber(int number) {
		this.number = number;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public void setPosition(String position) {
		this.position = position;
	}

	public void setQq(long qq) {
		this.qq = qq;
	}

	public void setSex(int sex) {
		this.sex = sex;
	}

	public void setTel(long tel) {
		this.tel = tel;
	}

	public Set<Employee> getRightEmployee() {
		return rightEmployee;
	}

	public void setRightEmployee(Set<Employee> rightEmployee) {
		this.rightEmployee = rightEmployee;
	}

	public Partment getPartmentID() {
		return partmentID;
	}

	public void setPartmentID(Partment partmentID) {
		this.partmentID = partmentID;
	}

}
